﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace HtmlAgilityPack
{
    public static class HtmlStripper
    {
        public static string GetText(string Html)
        {
            Html = Regex.Replace(Html, "\t|\r|\n|&nbsp;", " ");
            Html = Regex.Replace(Html, "</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->", " ");
            if (String.IsNullOrEmpty(Html)) return "";
            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(Html);
            return doc.DocumentNode.InnerText;
        }
    }
}
